package com.ysx.student.zhangqingrong.day05;

import java.util.Scanner;

/**
 * @author A
 */
public class Demo3 {

    public static void main(String[] args) {
        // 新建一个长度为三的数组；
        int[] nums = new int[4];
        // 键盘录入
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数：");
        int a = scanner.nextInt();
        System.out.println("请输入第二个数：");
        int b = scanner.nextInt();
        System.out.println("请输入第三个数：");
        int c = scanner.nextInt();
        System.out.println("请输入第四个数：");
        int d = scanner.nextInt();
        nums[0] = a;
        nums[1] = b;
        nums[2] = c;
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum = sum + nums[i];
        }
        System.out.println(sum);

    }

}
